<?php

use yii\helpers\Html;
use kartik\grid\GridView;
use yii\widgets\Pjax;
/* @var $this yii\web\View */
/* @var $searchModel admin\modules\rbac\models\RoleSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('app', '角色');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="role-index">
    <?php Pjax::begin(); ?>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?php echo Html::a(Yii::t('app', '创建角色'), ['create'], ['class' => 'btn btn-success']) ?>
    </p>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'kartik\grid\SerialColumn'],
            ['class' => 'kartik\grid\ActionColumn'],
            [
                'label'=>'更多操作',
                'format'=>'raw',
                'mergeHeader' => true,
                'value' => function($model){
                    return /*Html::a(\kartik\icons\Icon::show('group'), ['allot-user', 'role_id' => $model->id], ['title' => '分配用户']) . */Html::a(\kartik\icons\Icon::show('navicon'), ['allot-menu', 'role_id' => $model->id], ['title' => '分配菜单']) . /*Html::a(\kartik\icons\Icon::show('cubes'), ['allot-app', 'role_id' => $model->id], ['title' => '分配应用']) . */Html::a(\kartik\icons\Icon::show('hand-pointer-o'), ['allot-action', 'role_id' => $model->id], ['title' => '分配动作']);
                }
            ],
            'id',
            'name',
            'created_at',
            'created_by',
            'desc:ntext',
        ],
    ]); ?>
    <?php Pjax::end(); ?>
</div>
